# Makefile for libgoonix
# Copyright (C) 1994 Free Software Foundation, Inc.
# 
# This file is part of GNU Goonix
# 
# GNU Goonix is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2, or (at your option)
# any later version.
# 
# GNU Goonix is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
# 
# You should have received a copy of the GNU General Public License
# along with GNU SED; see the file COPYING.  If not, write to
# the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.

SHELL = /bin/sh

srcdir = @srcdir@
VPATH = @srcdir@
prefix = @prefix@
exec_prefix = $(prefix)
bindir = $(exec_prefix)/bin
libdir = $(exec_prefix)/lib
includedir = $(prefix)/include
infodir = $(prefix)/info

#### Start of system configuration section. ####

CC = @CC@
INSTALL = @INSTALL@
DEFS = @DEFS@
CFLAGS = -g -I. -I$(srcdir)/../libguile -I../libguile
AR = ar
AR_FLAGS = rc
RANLIB = @RANLIB@
source=ioext.c posix.c unix.c
xfiles=ioext.x posix.x unix.x
headers=ioext.h posix.h unix.h
ancillery=configure.in Makefile.in configure \
	  COPYING INSTALL ChangeLog \
	  PLUGIN
distfiles=$(source) $(headers) $(ancillery)
libobjs=ioext.o posix.o unix.o 

.SUFFIXES:
.SUFFIXES: .o .c .h .ps .dvi .info .texinfo .scm .cd .x

.c.x:
	$(CC) $(CFLAGS) -DSCM_MAGIC_SNARFER -E $< | grep "^%%%" | sed -e "s/^%%%//" > $@ ;

.c.o:
	$(CC) -c $(CFLAGS) $(DEFS) -I$(srcdir) $<

all: libgoonix.a

install: all
	test -d $(libdir) || mkdir $(libdir)
	test -d $(includedir) || mkdir $(includedir)
	$(INSTALL) libgoonix.a $(libdir)/libgoonix.a
	$(RANLIB) $(libdir)/libgoonix.a
	$(INSTALL) $(srcdir)/posix.h $(includedir)/posix.h
	$(INSTALL) $(srcdir)/ioext.h $(includedir)/ioext.h
	$(INSTALL) $(srcdir)/unix.h $(includedir)/unix.h


uninstall:
	-rm -f $(libdir)/libgoonix.a
	-rm -f $(includedir)/posix.h
	-rm -f $(includedir)/ioext.h
	-rm -f $(includedir)/unix.h

clean:
	-rm -f $(libobjs) $(xfiles) libgoonix.a

distclean: clean
	-rm Makefile config.status

mostlyclean: clean

realclean: distclean

TAGS:
	etags $(source)

info:

install-info:

clean-info:

dvi:

check:

SUBDIR=.
manifest:
	for file in $(distfiles); do echo $(SUBDIR)/$$file; done

dist:	$(distfiles)
	echo goonix-`sed -e '/version_string/!d' -e 's/[^0-9.]*\([0-9.]*\).*/\1/' -e q goonix.c` > .fname
	rm -rf `cat .fname`
	mkdir `cat .fname`
	ln $(distfiles) `cat .fname`
	tar chzf `cat .fname`.tar.gz `cat .fname`
	rm -rf `cat .fname` .fname


libgoonix.a: $(libobjs)
	rm -f libgoonix.a
	$(AR) $(AR_FLAGS) libgoonix.a $(libobjs)
	$(RANLIB) libgoonix.a

ioext.o: ioext.c ioext.h ioext.x
posix.o: posix.c posix.h posix.x
unix.o: unix.c unix.h unix.x

